import 'package:flutter/material.dart';
import 'package:flutter_shop/pages/common/login/entity/user_info.dart';

/// Title:登录状态管理 <br/>
/// Description: <br/>
/// author:xiemiao <br/>
/// date: 2020-03-12  <br/>
/// version 1.0 <br/>
class LoginProvider with ChangeNotifier {
  UserInfo userInfo;

  ///是否已登录
  bool get isLogin => userInfo != null;

  ///设置userinfo
  void setUserInfo(UserInfo userInfo) {
    this.userInfo = userInfo;
    notifyListeners();
  }

  ///清除用户信息
  void clearUserInfo() {
    this.userInfo = null;
    notifyListeners();
  }
}
